<?php

/*

COMP 353F
Dr. B Desai
Final Project
Group #11

6330746 Nicholas CONSTANTINIDIS
9532862 Jacqueline FU
5484537 Claudio Javier LOPEZ FLORES
9218416 Que Tung NGUYEN

*/

  session_start();
?>

<!DOCTYPE html>
<html lang="en">
<head>
        <title>CoBAGSys - Home</title>
        <link type="text/css" rel="stylesheet" href="css/mystyle.css">
</head>
<body>
	<?php
		require 'menus.php';
	?>
	<?php
		// Create the member profile
		function getMemberInfo()
		{
			$db = new Connect();
			
			$sql = "SELECT mName, email FROM MemberInfo WHERE mID = " . $_SESSION["mid"];
			$result = $db->query($sql);
			
			if(!$result || mysql_num_rows($result) == 0) // Couldn't find member
			{
				return;
			}
			else // Return member info
			{
				$rows = $db->to_array($result);
				return $rows[0];
			}
		}

		function getTransactions() 
		{
			$db = new Connect();
			
			// TODO: Use the real table name and columns
			$sql = "SELECT pID, pName, price, status " .
				"FROM Posting " .
				"WHERE mid = " . $_SESSION['mid'];
			$result = $db->query($sql);
			
			if(!$result || mysql_num_rows($result) == 0) // Couldn't find posting
			{
				return;
			}
			else // Return posting info
			{
				$rows = $db->to_array($result);
				return $rows;
			}
		}
	?>
    	<div id="main">	
		<p class="title">My Profile</p>
		
		<?php
			$info = getMemberInfo();
	
			print "<p class=\"normal\">Member Name: " . $info['mName'] . "</p>";
			print "<p class=\"normal\">Email: " . $info['email'] . "</p>";
		?>
	</div>
</body>
</html>
